package kr.co.goodwilldd.framework.email;

import kr.co.goodwilldd.framework.email.model.EmailBody;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class EmailSender implements ApplicationContextAware {
	private ApplicationContext ctx;

	@Override
	public void setApplicationContext(ApplicationContext applicationContext)
			throws BeansException {
		this.ctx = applicationContext;
	}

	public void emailSend(EmailBody mail) {
		EmailEvent event = new EmailEvent(mail);
		ctx.publishEvent(event);
	}
}
